﻿using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace StaticFilesSample.Middlewares
{
    public class RequestRecordMiddleware
    {
        private readonly RequestDelegate _requestDelegate;
        private readonly ILogger<RequestRecordMiddleware> _logger;
        public RequestRecordMiddleware(RequestDelegate requestDelegate,
            ILogger<RequestRecordMiddleware> logger)
        {
            _requestDelegate = requestDelegate;
            _logger = logger;
        }

        public async Task InvokeAsync(HttpContext context)
        {
            await context.Response.WriteAsync("Record request.");
            await _requestDelegate.Invoke(context);
        }
    }
}
